layui.use(['carousel', 'form'], function(){
  var carousel = layui.carousel,
  form = layui.form;

  //设定各种参数
  var ins3 = carousel.render({
	elem: '#test3',
	width: '691px',
	height: '600px',
	interval: 1800,
	anim: 'fade',
	interval: 2000,
	arrow: 'none',
	indicator: 'none'
  });


  //监听开关
  form.on('switch(autoplay)', function(){
	  if (this.checked) {
	  	var img_list = "";
		$(".css-day_content input").each(function(){
			if(this.checked){
				console.log($(this).attr("title"));
				img_list += '<div><div class="css-carousel_title layui-col-xs9">'
				+ $(this).attr("title") +'</div><img src="'
				+ $(this).attr("imgSrc") +'"></div>';
			}
		});
		if(img_list.length>0){$("#imgList").html(img_list);}

	  }
	  ins3.reload({
	    autoplay: this.checked
	  });
  });

  form.on('checkbox(checkList)', function(data){
	  // if(!this.checked){
		    ins3.reload({
	  	  	  autoplay: false
	  	  	});

			$(".css-autoplay").removeAttr('checked');
			form.render();
	  // }

  });


});

layui.use('laydate', function(){
	var laydate = layui.laydate; 
	laydate.render({   
		elem: '.css-date'   

	}); 
});

// check框点击事件
$(".css-day_content").on("click","span",function(){
	// alert(111);
});

//自适应高度
var  auto_height = $(window).height() - 117;
$(".css-auto_height").css("height",auto_height);
$(".css-day_content").css("height",auto_height - 150);
if (auto_height>660) {$("#test3").css("marginTop",(auto_height-660)/2);}
else{$("#test3").css("marginTop","0");}
$(window).resize(function(){
	var  auto_height = $(window).height() - 117;
	$(".css-auto_height").css("height",auto_height);
	$(".css-day_content").css("height",auto_height - 150);
	if (auto_height>660) {$("#test3").css("marginTop",(auto_height-660)/2);}
	else{$("#test3").css("marginTop","0");}
})


$.ajax({
	   type : "get",  //提交方式
	   url : API_HEAD + "/navel/faroutNavel",//路径
	   dataType: "jsonp",
	   // data : {
		//    "org.id" : "org.id"
	   // },//数据，这里使用的是Json格式进行传输
	   success : function(result) {//返回数据根据结果进行相应的处理
		   console.log(result);
	   },
	   error :function(XMLHttpRequest, textStatus, errorThrown){
          console.log(textStatus);
       }
   });
